<!doctype html>
<html lang="en">
 <head>
  <meta charset="UTF-8">
  <title>省市县</title>
 </head>
 <script src="provincesdata.js"></script>
 <body>
  <span id="province"></span>
  <span id="city"></span>
  <span id="town"></span>
  <script type="text/javascript">
	var str = "<select onchange='city(this.value)'>";
	for (var i=0; i<GP.length; i++)
	{
		str = str + "<option value="+i+">" + GP[i] + "</option>";
	}
	str = str + "</select>";
	document.getElementById("province").innerHTML=(str);
	
	function city(pid){
		var str = "<select onchange='town("+pid+",this.value)'>";
		for (var i=0; i<GT[pid].length; i++)
		{
			str = str + "<option value="+i+">" + GT[pid][i] + "</option>";
		}
		str = str + "</select>";
		document.getElementById("city").innerHTML=(str);
	}

	function town(pid,cid){
		var str = "<select>";
		for (var i=0; i<GC[pid][cid].length; i++)
		{
			str = str + "<option>" + GC[pid][cid][i] + "</option>";
		}
		str = str + "</select>";
		document.getElementById("town").innerHTML=(str);
	}

 </script>
 </body>
</html>
